package xman.core.component;

import org.springframework.context.ApplicationContext;

public class SpringUtil {
    private static ApplicationContext applicationContext;
    
    public static Object getBean(String name) {
        if (applicationContext == null) {
            throw new RuntimeException("Spring application context initialization error");
        }
        return applicationContext.getBean(name);
    }
    
    public static void setApplicationContext(ApplicationContext applicationContext) {
        SpringUtil.applicationContext = applicationContext;
    }
}
